<?php require 'header.php'; ?>
			<div class="row">
				<div class="span3">
					<div class="well" style="padding: 8px 0;">
						<ul class="nav nav-list">
							<li class="nav-header">
								TechAfghanistan
							</li>
							<li>
								<a href="index.php"><i class="icon-home"></i> Home</a>
							</li>
							<li>
								<a href="authors.php"><i class="icon-user"></i> Authors</a>
							</li>
							<li>
								<a href="posts.php"><i class="icon-th-list"></i> Posts</a>
							</li>
						</ul>
					</div>
				</div>
			<div class="span9">
					<h2>
						Authors
					</h2>
					<?php if(isset($_GET['add'])){
						?>
						<div class="alert alert-success">Author Added Successfully</div>
						<?php

					} ?>
					<?php if(isset($_GET['delete'])){
						?>
						<div class="alert alert-warning">Author Deleted Successfully</div>
						<?php

					} ?>
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>
									#
								</th>
								<th>
									Twitter ID
								</th>
								<th>
									First Name
								</th>
								<th>
									Last Name
								</th>
								<th>
									Email
								</th>
								<th>
									Role
								</th>
								<th>
									Actions
								</th>
								
								
								</tr>
							
						</thead>
						<tbody>
							<?php
								$authorSelectQry = $conn->query("SELECT * FROM `users` WHERE 'role'<>'main_admin'");
								$count = 1;
								while($authorSelectRow=$authorSelectQry->fetch()){
									$authorTwitter = $conn->query("SELECT * FROM `user_authors` WHERE id = '".$authorSelectRow['id']."' ");
									$twitter_id = $authorTwitter->fetch();
								?>
								<tr><td><?php echo $count; ?></td><td><?php echo $twitter_id['twitter_id']; ?></td><td><?php echo $authorSelectRow['firstname']; ?></td><td><?php echo $authorSelectRow['lastname']; ?></td><td><?php echo $authorSelectRow['email']; ?></td><td><?php echo $authorSelectRow['role']; ?></td><td><a href="execute/remove_author.php?id=<?php echo $authorSelectRow['id']; ?>" onClick="return confirm('Delete this user?')"><i class="fa fa-trash-o"></i></a></td></tr>
									<?php
								$count++;
								}
							?>
						</tbody>
						
					</table>
					
					<a class="toggle-link" href="#new-file"><i class="icon-plus"></i> Add New Author</a>
					<form id="new-file" action="execute/add_author.php" method="post" class="form-horizontal hidden">
						<fieldset>
							<legend>New Author</legend>
							<div class="control-group">
								<label class="control-label" for="textarea">Twitter ID</label>
								<div class="controls">
									<input type="text" class="input-xlarge" name="twitter_id" id="input01" required/>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="textarea">First Name</label>
								<div class="controls">
									<input type="text" class="input-xlarge" name="firstname" id="input01" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="textarea">Last Name</label>
								<div class="controls">
									<input type="text" class="input-xlarge" name="lastname" id="input02" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="textarea">Email</label>
								<div class="controls">
									<input type="text" class="input-xlarge" name="email" id="input03" />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="textarea">Password</label>
								<div class="controls">
									<input type="password" class="input-xlarge" name="password" id="input03" />
								</div>
							</div>
						
							<div class="form-actions">
								<button type="submit" name="submit" class="btn btn-primary">Add Author</button> <button class="btn">Cancel</button>
							</div>
						</fieldset>
					</form>
				</div>
			</div>
		</div>
		<script src="js/jquery.min.js"></script>
		<script src="js/bootstrap.min.js"></script>
		<script src="js/site.js"></script>
	</body>

<!-- Mirrored from wbpreview.com/previews/WB0070A9H/index.htm by HTTrack Website Copier/3.x [XR&CO'2013], Wed, 22 Jan 2014 10:31:21 GMT -->
</html>